/*
 * XYNeighborhood.java
 *
 * Created on September 17, 2004, 1:03 PM
 */

package edu.temple.GUS.MMA.Neighborhoods;

/**
 *
 * @author  jeffleon
 */
public class XYNeighborhood extends MMANeighborhood{
    
    protected int x;
    protected int y;

    /** Creates a new instance of XYNeighborhood */
    public XYNeighborhood(int x, int y)
    {
        this.x = x;
        this.y = y;
    }

    // Return the lower boundary of the neighborhood in x-direction
    // assuming the position of the center is zero
    public int getXLowerBoundary()
    {
        return -x/2;    
    }

    // Return the upper boundary of the neighborhood in x-direction
    // assuming the position of the center is zero
    public int getXUpperBoundary()
    {
        // Even number of units
        if (x%2 == 0)
            return x/2 - 1;
        else
            return x/2;    
    }

    // Return the lower boundary of the neighborhood in y-direction
    // assuming the position of the center is zero
    public int getYLowerBoundary()
    {
        return -y/2;    
    }

    // Return the upper boundary of the neighborhood in y-direction
    // assuming the position of the center is zero
    public int getYUpperBoundary()
    {
        // Even number of units
        if (y%2 == 0)
            return y/2 - 1;
        else
            return y/2;    
    }
}
